<template>
  <div class="header">
    <div class="header-left">
      <span class="iconfont">&#xe8b5;</span>
    </div>
    <div class="header-input"><i class="iconfont">&#xe651;</i>请输入搜索内容</div>
    <router-link to="/city">
      <div class="header-right">{{this.city}}
        <i class="iconfont">&#xe600;</i>
      </div>
    </router-link>

  </div>
</template>

<script>
import {mapState, mapGetters} from 'vuex'
export default {
  name: 'HomeHeader',
  computed: {
    // 展开运算符 将state的内容映射到计算属性的city中
    ...mapState(['city']),
    ...mapGetters(['doubleCity'])
  }
}
</script>

<style scoped lang="stylus">
  @import '~@styles/varibles.styl'
  .header
    line-height $headerHeight
    display flex
    background-color $bgColor
    color #ffffff
    .header-left
      text-align center
      width .64rem
      float left
    .header-input
      height .64rem
      line-height .64rem
      border-radius .1rem
      margin-left .2rem
      padding-left .2rem
      margin-top .12rem
      background-color #ffffff
      flex 1
      color #ccc
    .header-right
      color #ffffff
      min-width 1.04rem
      padding 0 0.1rem
      float right
      text-align center
</style>
